<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>MCU MANAGER</title>
	<%@ include file="/WEB-INF/jsp/common/cssjs2.jsp" %>
	
	<script type="text/javascript">
		var smtpObj=new SMTP();
		//entrance		
		$(function(){
			smtpObj.init();
		});
		
		function SMTP(){
			var self=this;
			
			this.init=function(){
				$('.easyui-validatebox').validatebox();
				$('.easyui-validatebox[required]').after("<font color='red'> *</font>");
				
				$("#chk_verify").click(function(){
					$("input[name='verify']").val(this.checked);
				});
				
				if("${model.verify}"=="true"){
					$("#chk_verify").attr("checked",true);
				}
			};
			
			this.submit=function(){
				$('#id_form').form('submit', {
			        url:"<c:url value='/app/setup/smtp'/>",
			        onSubmit: function(){
			        	if($('.easyui-validatebox').validatebox("isValid")==false){
			        		return false;
			        	}else{
							return true;
						}
			        },
			        success:function(data){
						alert(data);
						parent.closeWin();
			        }
				});
			};
		}
	</script>
	
	<style type="text/css">
	    html, body,form {
	        width: 100%;
	        height: 100%;
	        margin: 0px;
	        overflow: hidden;
	    }
	</style>
</head>
<body class="dialog">
<form id="id_form" method="post">
<input type="hidden"  name="_method" value="PUT" />
<table border="0" style="width:100%;text-align:left;font-size:12px;margin:5px;" cellpadding="3" cellspacing="0">
	<tbody>
		<tr>
			<td width="30%"><fmt:message key='setup.smtp.host'/></td>
			<td width="70%"><input type="text" name="host" value="${model.host}" class="easyui-validatebox" required="true"/></td>
		</tr>
		<tr>
			<td width="30%"><fmt:message key='setup.smtp.email'/></td>
			<td width="70%"><input type="text" name="email" value="${model.email}" class="easyui-validatebox" required="true" validtype="email" /></td>
		</tr>
		<tr>
			<td width="30%"><fmt:message key='setup.smtp.user'/></td>
			<td width="70%">
				<input type="text" name="user" value="${model.user}" class="easyui-validatebox" required="true" />
			</td>
		</tr>
		<tr>
			<td width="30%"><fmt:message key='setup.smtp.password'/></td>
			<td width="70%">
				<input type="password" name="password" value="${model.password}" class="easyui-validatebox" required="true" />
			</td>
		</tr>
		<tr>
			<td width="30%"><fmt:message key='setup.smtp.verify'/></td>
			<td width="70%">
				<input type="checkbox" id="chk_verify"/>
				<input type="hidden" name="verify" value="<c:out value='${model.verify}' default='false' />" />
			</td>
		</tr>
		<tr>
			<td colspan="2">
                <input type="button" onclick="smtpObj.submit();" class="mybtn" value="<fmt:message key='btn.ok'/>">
				<button onclick="parent.closeWin();" class="mybtn"><fmt:message key='btn.cancel'/></button>
			</td>
		</tr>
	</tbody>
</table>
</form>
</body>
</html>